/**
 * 
 */
package com.jytc.framework.bo.impl;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jytc.framework.bo.FwPermissionBO;
import com.jytc.framework.dao.FwPermissionDAO;
import com.jytc.framework.dto.FwPermissionDTO;
import com.jytc.framework.po.FwPermission;

/**
 * @title: 
 * @description: 
 * 
 * @author: dongyuese
 *
 */
@Service
public class FwPermissionBOImpl implements FwPermissionBO
{
	/**
	 * 权限信息数据访问对象
	 */
	@Autowired
	private FwPermissionDAO sysPermissionDAO;

	public List<FwPermissionDTO> findAll() throws Exception
	{
		//List<FSysPermission> menuList = frameSysMenuDAO.findAll(Order.asc("menuSort"));
		List<FwPermission> menuList = sysPermissionDAO.findAll();
		List<FwPermissionDTO> resultList = new ArrayList<FwPermissionDTO>();
		for (FwPermission frameSysMenu : menuList)
		{
			FwPermissionDTO permissionDTO = new FwPermissionDTO();
			BeanUtils.copyProperties(permissionDTO, frameSysMenu);
			resultList.add(permissionDTO);
		}
		return resultList;
	}

	/**
	 * 根据系统类型查询菜单信息
	 * @param systemId　系统类型
	 * @return　权限信息集合
	 * @throws Exception
	 */
	public List<FwPermission> findBySystemId(Integer systemType) throws Exception
	{
		return sysPermissionDAO.findByProperty("systemType", systemType);
	}

}
